package com.study.designer.creator.factory;

import com.study.designer.creator.factory.commodity.ICommodity;
import com.study.designer.creator.factory.commodity.impl.CardCommodityService;
import com.study.designer.creator.factory.commodity.impl.CouponCommodityService;
import com.study.designer.creator.factory.commodity.impl.GoodsCommodityService;

public class CommodityFactory {
    public ICommodity getCommodityService(Integer commodityType) {
        if (1 == commodityType) return new CouponCommodityService();
        if (2 == commodityType) return new GoodsCommodityService();
        if (3 == commodityType) return new CardCommodityService();
        throw new RuntimeException("不存在的商品服务类型");
    }
}
